package com.swagger.knife4jdemo.service.impl;

import com.swagger.knife4jdemo.common.Result;
import com.swagger.knife4jdemo.entity.CityEntity;
import com.swagger.knife4jdemo.service.CityService;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 哲思小辉
 * @version 1.0.0
 * @ClassName CityServiceImpl.java
 * @Description 城市服务实现类
 * @Param
 * @createTime 2020年03月24日 16:56:00
 */
@Service
@Slf4j
public class CityServiceImpl implements CityService {
    @Override
    public Result<List<CityEntity>> getCityList() {
        val cityEntities = new ArrayList<CityEntity>();
        val szCityEntity = new CityEntity(166666666L, "深圳市", "0721", "一线城市");
        val whCityEntity = new CityEntity(188888888L, "武汉市", "027", "二线城市");
        cityEntities.add(szCityEntity);
        cityEntities.add(whCityEntity);
        log.debug("---------城市列表获取成功-------->");
        return Result.success(cityEntities);
    }

    @Override
    public Result<CityEntity> addCity(CityEntity cityEntity) {
        cityEntity.setCityId(888888888L);
        log.debug("---------新增城市成功-------->");
        return Result.success(cityEntity);
    }

    @Override
    public Result deleteCity(Long cityId) {
        log.debug("---------删除cityId=[{}]城市成功-------->", cityId);
        return Result.success();
    }
}
